<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>


<!-- 文件上传需要的样式 -->

<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>

<title></title>
</head>


<div class="ibox-content">
	<form class="form-horizontal" id="dataform"
		onsubmit="javascripr:return false;">

		<input type="hidden" name="tokenUrl" value="${tokenUrl}"> <input
			type="hidden" name="token" value="${token}">
		<c:if test="${obj ne null }">
			<input type="hidden" name="id" value="${obj.id }">
		</c:if> 
	 <input type="hidden" id="projId" name="projId" value="${projId}">
		<div id="meeting">
			<div class="form-group">
				<label class="col-sm-2 control-label">会议主题</label> 
				<div class="col-sm-4">
				<input type="text"  class="form-control"
						name="meetingTheme" dataType="*" value="<c:out value='${obj.meetingTheme}' />" nullmsg="主题不能为空">
						<div class="Validform_checktip"></div>
				</div>
				<label class="col-sm-1 control-label">会议主持</label> 
				<div class="col-sm-4">
				<input type="text" class="form-control"
						name="emcee" value="<c:out value='${obj.emcee}' />" dataType="*" nullmsg="主持不能为空">
						<div class="Validform_checktip"></div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">会议地点</label> 
				<div class="col-sm-4">
				<input type="text"  class="form-control"
						name="meetingAddress" value="<c:out value='${obj.meetingAddress}' />" dataType="*"  nullmsg="地点不能为空">
						<div class="Validform_checktip"></div>
				</div>
				<label class="col-sm-1 control-label">会议开始时间</label> 
				<div class="col-sm-4">
				 <input type="text" class="form-control" id="datetimepicker" dataType="*" nullmsg="时间不能为空"
						name="meetingTime" value="<fmt:formatDate value='${obj.meetingTime}' type="date"  pattern="yyyy-MM-dd hh:mm:ss"/>">
						<div class="Validform_checktip"></div> 
				</div> 
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">参会人员</label> 
				<div class="col-sm-4">
					<input type="text"  class="form-control"
							name="participants" value="<c:out value='${obj.participants}' />" dataType="*" nullmsg="参会人员不能为空">
							<div class="Validform_checktip"></div>
					</div>
					<label class="col-sm-1 control-label">会议状态</label> 
					<div class="col-sm-4">
					<select class="form-control" name="status">
						<option value="开始" <c:if test="${obj.status eq 开始}">selected="selected"</c:if>>开始</option>
						<option value="延迟" <c:if test="${obj.status eq 延迟}">selected="selected"</c:if>>延迟</option>
						<option value="取消" <c:if test="${obj.status eq 取消}">selected="selected"</c:if>>取消</option>
						<option value="结束" <c:if test="${obj.status eq 结束}">selected="selected"</c:if>>结束</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">会议摘要</label> 
				<div class="col-sm-8">
				<textarea name="meetingAbstracts">${obj.meetingAbstracts}</textarea>
				</div>
			</div>
		<c:choose>
			<c:when test="${!empty obj.meetingContent1}">
				<c:forEach items="${obj.meetingContent1}" var="item">
					<div class="form-group">
						<label class="col-sm-2 control-label">会议要点${item.orderby}</label> 
						<div class="col-sm-8" name="contents">
						<textarea name="content"+${item.orderby} rows="5px" cols="100%">${item.content}</textarea>
						</div>
					</div>
				</c:forEach>
			</c:when>
			<c:otherwise>
				<div class="form-group">
					<label class="col-sm-2 control-label">会议要点1</label> 
					<div class="col-sm-8" name="contents">
					<textarea name="content[0]" rows="5px" cols="100%"></textarea>
					</div>
				</div>
			</c:otherwise>
		</c:choose>
		
			
		</div>
		<div class="form-group">
			<div class="col-sm-3 col-sm-offset-2">
			<input type="button" class="btn btn-primary" value="添加会议要点" onclick="addContents()">
			</div>
		</div>
		
		<div class="form-group ">
			<div class="col-sm-12 text-center" >
				<a href="javascript:;" onclick="myForm.submit()"
					class="btn btn-success radius">保存</a>&nbsp;&nbsp;&nbsp;&nbsp;
				<button onclick="MTools.closeForm()" class="btn btn-danger radius">取消</button>
			</div>
		</div>
	</form>
</div>

</body>
<script type="text/javascript">

	 var editor;
	 var myForm;
	$(function(){
		MUI.createEdit("meetingAbstracts", '100%', '200px', 'editor');
		 myForm=MForm.initForm({
			invokeUrl:"${path}/admin/meeting/addOrModify",
			beforeSubmit:function(){
				console.log($("#datetimepicker").val());
				editor.sync();
			},
			
			extendParam : {},
			afterSubmit:function(){
				parent.myGrid.serchData();
			},
		});
		 
		 $('#datetimepicker').datetimepicker({
			    format: 'yyyy-mm-dd hh:ii:ss',
			    autoclose:true
		 });
	})
	//添加要点
	function addContents(){
		var index=document.getElementsByName("contents").length;
		html='<div class="form-group">'
			+'<label class="col-sm-2 control-label">会议要点'+(index+1)+'</label>'
			+'<div class="col-sm-8" name="contents">'
			+'<textarea name="content['+index+']" rows="5px" cols="100%"></textarea>'
			+'</div></div>'
		$("#meeting").append(html);
		
	} 
	


</script>
</html>
